﻿@using XStudio.WebFramework.Mvc.Extensions
<script type="text/javascript">
    var ProductionGoodsList = {};

    //表格显示修改按钮
    ProductionGoodsList.EditFormatter = function (value, rec, index) {
        return "<a  class='btn-edit' href='" + $("#goodseditUrl").val() + "/" + rec.UID + "' onclick='ProductionGoodsList.Edit(this); return false;' >修改</a>";
    }
    //修改按钮触发方法
    ProductionGoodsList.Edit = function (e) {
        var title = "修改" + $(e).parents("tr").find("td:first").text();
        $.createWin({ url: e.href, width: 550, height: 450, title: title });
    }
    //表格显示删除按钮
    ProductionGoodsList.DeleteFormatter = function (value, rec, index) {
        return "<a  class='btn-del' href='" + $("#goodsdelUrl").val() + "/?id=" + rec.UID + "&type=2" + "' onclick='ProductionGoodsList.Delete(this); return false;' >删除</a>";
    }
    //删除按钮触发事件
    ProductionGoodsList.Delete = function (e) {
        if (!confirm("确认要删除吗？"))
            return;
        $.post($(e).attr("href"), function (data) {
            if (data.IsOK) {
                $('#tbProductionGoodsList').datagrid('reload');
            }
            else
                alert(data.Description);
        });
    }
    //是否执行ready函数标记
    ProductionGoodsList.Binded = false;

    $(document).ready(function () {
        if (ProductionGoodsList.Binded) return;
        ProductionGoodsList.Binded = true;
        //按钮搜索事件
        $("#btnIMEIInfoSearch").unbind("click");
        $("#btnIMEIInfoSearch").click(function () {
            $("#tbProductionGoodsList").datagrid({ pageNumber: 1, queryParams: { SearchWord: $("#txtIMEIInfoSearchWord").val() } });
        });
        //呈现列表数据
        $("#tbProductionGoodsList").datagrid({ pagination: true });
    });

</script>
@Html.Hidden("goodseditUrl", Url.Action("Edit"))
@Html.Hidden("goodsdelUrl", Url.Action("Delete", "Start"))
<div class="tt-attach">
    <ul class="op">
        <li>
            <input class="search-text" id="txtIMEIInfoSearchWord" style="width: 150px;" type="text" placeholder="请输入IMEI进行搜索" title="请输入IMEI进行搜索" value="" /><input id="btnIMEIInfoSearch" class="search-button" value="搜索" type="button" />
        </li>
    </ul>
</div>
<div style="padding: 5px 10px;">
    <table id="tbProductionGoodsList" style="height:auto" stridep="true" rownumbers="true" fitColumns="true" title="" iconcls="icon-edit" fix="true"
           idfield="UID" pagesize="30" url="@Url.Action("ListData")">
        <thead>
            <tr>
                <th field="UID" checkbox="true" width="150">
                </th>
                <th field="Account" width="80" align="center">
                    帐号
                </th>
                <th field="Name" width="80" align="center">
                    名称
                </th>
                <th field="Address" width="80" align="center">
                    地址
                </th>
                <th field="LikeUserName" width="80" align="center">
                    联系人
                </th>
                <th field="LikePhone" width="80" align="center">
                    联系电话
                </th>
                <th field="CommissionRules" width="80" align="center">
                    佣金（%）
                </th>
                <th field="AlipayAccount" width="80" align="center">
                    支付宝帐号
                </th>
                <th field="AlipayName" width="80" align="center">
                    支付宝名称
                </th>
                <th field="CreateDateTime" formatter="Common.DateTimeFormatter" width="100" align="center">
                    创建时间
                </th>
                @if (Html.Auth("Edit"))
                {
                    <th field="修改" width="50" formatter="ProductionGoodsList.EditFormatter" align="center">
                        修改
                    </th>
                }
                @if (Html.Auth("Delete"))
                {
                    <th field="删除" width="50" formatter="ProductionGoodsList.DeleteFormatter" align="center">
                        删除
                    </th>
                }
            </tr>
        </thead>
    </table>
</div>
